<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
<title>Hello APP</title>
<link rel="stylesheet" type="text/css" href="../../css/aui-flex.css" />
<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
<link rel="stylesheet" type="text/css" href="../../css/common.css" />
<style>
	#header {
		background: #FFF;
		border: none;
	}
	#header .back {
		background-image: url(../../image/common/30.png);
	}
	.comPublishBtn {
		min-width: 3.2rem;
	}
	.draftBtn {
		margin-right: 0.75rem;
		background: #FFF;
		color: #adadad;
		border: 1px solid #adadad;
		line-height: 1.3rem;
	}
</style>
</head>

<body>
	<header class="aui-bar aui-bar-nav aui-bar-light" id="header">
        <div class="aui-pull-left back" tapmode onClick="quit();"></div>
        <div class="aui-pull-right aui-flex-col aui-flex-middle">
        	<div class="comPublishBtn draftBtn" tapmode onClick="draft();">存草稿</div>
        	<div class="comPublishBtn" tapmode onClick="save(1);">发布</div>
        </div>
    </header>
    
</body>
<script type="text/javascript" src="../../script/import.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
    apiready = function() {
        api.parseTapmode();
		var header = $api.byId('header');
        $api.fixStatusBar(header);
        var headerH = $api.offset(header).h;
        api.openFrame({
            name: 'publish_finish_frm',
            url: 'publish_finish_frm.html',
            rect: {
                x: 0,
                y: headerH,
                w: 'auto',
                h: 'auto'
            },
			bounces: false,
			reload: true,
            pageParam: api.pageParam
        });
    };
	function quit(){
		var confirmMaskTxt = ['您将退出发布，是否存草稿？','不保存','存草稿'];
		openConfirmMask(confirmMaskTxt,'save(0)','closeToRoot()');
	}
	function draft(){
		var confirmMaskTxt = ['需要存草稿吗？','取消','存草稿'];
		openConfirmMask(confirmMaskTxt,'save(0)');
	}
	function closeToRoot(){
		if(getPrefs('_PUBLISH_EDIT_ID_')){
			api.closeToWin({
				name: 'my_draft_win'
			});
		}else{
			api.closeToWin({
				name: 'root'
			});
		}
	}
	function save(n){
		api.execScript({
			frameName: 'publish_finish_frm',
			script:'save('+n+');'
		});
	}
</script>
</html>
